/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.AttributeCallback.SingleValueMod;
/*    */ import com.zimbra.cs.account.DistributionList;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.ldap.LdapDIT;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DisplayName
/*    */   extends AttributeCallback
/*    */ {
/*    */   public void preModify(CallbackContext context, String attrName, Object value, Map attrsToModify, Entry entry)
/*    */     throws ServiceException
/*    */   {
/* 37 */     if ((!(entry instanceof Account)) && (!(entry instanceof DistributionList))) { return;
/*    */     }
/*    */     
/*    */ 
/*    */ 
/* 42 */     AttributeCallback.SingleValueMod mod = singleValueMod(attrName, value);
/* 43 */     if (mod.unsetting()) {
/* 44 */       return;
/*    */     }
/* 46 */     String displayName = mod.value();
/*    */     
/* 48 */     String namingRdnAttr = null;
/* 49 */     Provisioning prov = Provisioning.getInstance();
/* 50 */     if ((prov instanceof LdapProv)) {
/* 51 */       namingRdnAttr = ((LdapProv)prov).getDIT().getNamingRdnAttr(entry);
/*    */     }
/*    */     
/*    */ 
/* 55 */     if ((namingRdnAttr == null) || (!namingRdnAttr.equals("cn")))
/*    */     {
/* 57 */       if (!attrsToModify.containsKey("cn")) {
/* 58 */         attrsToModify.put("cn", displayName);
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry) {}
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/DisplayName.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */